#include<bits/stdc++.h>
using namespace std;
// using namespace std::chrono;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
#define endl "\n";

namespace DBG
{
    template <class T>
    ostream& operator << (ostream& os,const vector<T> &v)
    {
        os<<"[ ";
        for (int i=0;i<v.size();i++)
        {
            os<<v[i];
            if (i+1<v.size())
                os<<", ";
        }
        os<<" ]";
        return os;
    }

    template <class T,size_t N>
    ostream& operator << (ostream& os,const array<T,N> &v)
    {
        os<<"[ ";
        for (int i=0;i<v.size();i++)
        {
            os<<v[i];
            if (i+1<v.size())
                os<<", ";
        }
        os<<" ]";
        return os;
    }

    template <class T>
    void _dbg(const char *f,T t)
    {
        cerr<<f<<'='<<t<<'\n';
    }

    template <class A,class... B>
    void _dbg(const char *f,A a,B... b)
    {
        while (*f!=',') cerr<<*f++;
        cerr<<'='<<a<<",";
        _dbg(f+1,b...);
    }

    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
}

using namespace DBG;

void solve(){
    int n;
    cin>>n;
    vector<int>a(n+1);
    string s;
    cin>>s;
    for(int i=0;i<n;i++){
        if(i==0){
            if(s[i]=='0'&&s[i+1]=='1'){
                cout<<"NO"<<endl;
                return;
            }
            continue;
        }
        if(i==n-1){
            if(s[i]=='0'&&s[i-1]=='1'){
                cout<<"NO"<<endl;
                return;
            }
            continue;
        }
        if(s[i]=='0'&&s[i+1]=='1'&&s[i-1]=='1'){
            cout<<"NO"<<endl;
            return;
        }
    }
    // for(int i=1;i<=n;){
    //     // dbg(i);
    //     if(s[i-1]=='1'){
    //         a[i]=i;
    //         i++;
    //         continue;
    //     }
    //     int l=i,r=i;
    //     while(r<=n&&s[r-1]=='0')r++;
    //     int temp=r-1;
    //     for(int j=l;j<r;j++){
    //         a[i]=temp;
    //         temp--;
    //     }
    //     i=r;

    // }
    int l=-1;
    for(int i=1;i<=n;i++)a[i]=i;
    for(int i=0;i<n;i++){
        if(s[i]=='0' && l==-1){
            l=i+1;
        }else if(s[i]=='1' && l!=-1){
            reverse(a.begin()+l,a.begin()+i+1);
            l=-1;
        }
    }
    if(l!=-1)
        reverse(a.begin()+l,a.begin()+n+1);
    cout<<"YES"<<endl;
    for(int i=1;i<=n;i++){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    // auto start = high_resolution_clock::now();
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    // auto end = high_resolution_clock::now();
    // auto duration = duration_cast<microseconds>(end - start);
    // cout << "Time: " << duration.count()/1000 << " ms" << endl;
    return 0;
}